home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / isinteractive.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  93 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: isinteractive.c,v 1.4 1996/10/24 15:50:31 aros Exp $
  4.     $Log: isinteractive.c,v $
  5.     Revision 1.4  1996/10/24 15:50:31  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.3  1996/08/13 13:52:48  digulla
  9.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  10.     Replaced AROS_LA by AROS_LHA
  11.  
  12.     Revision 1.2  1996/08/01 17:40:53  digulla
  13.     Added standard header for all files
  14.  
  15.     Desc:
  16.     Lang: english
  17. */
  18. #include <clib/exec_protos.h>
  19. #include <dos/filesystem.h>
  20. #include "dos_intern.h"
  21.  
  22. /*****************************************************************************
  23.  
  24.     NAME */
  25.     #include <clib/dos_protos.h>
  26.  
  27.     AROS_LH1(BOOL, IsInteractive,
  28.  
  29. /*  SYNOPSIS */
  30.     AROS_LHA(BPTR, file, D1),
  31.  
  32. /*  LOCATION */
  33.     struct DosLibrary *, DOSBase, 36, Dos)
  34.  
  35. /*  FUNCTION
  36.     Check if file is bound to an interactive device such as a console
  37.     or shell window.
  38.  
  39.     INPUTS
  40.     file   - filehandle
  41.  
  42.     RESULT
  43.     !=0 if the file is interactive, 0 if it is not.
  44.  
  45.     NOTES
  46.  
  47.     EXAMPLE
  48.  
  49.     BUGS
  50.  
  51.     SEE ALSO
  52.  
  53.     INTERNALS
  54.  
  55.     HISTORY
  56.     29-10-95    digulla automatically created from
  57.                 dos_lib.fd and clib/dos_protos.h
  58.  
  59. *****************************************************************************/
  60. {
  61.     AROS_LIBFUNC_INIT
  62.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  63.  
  64.     /* Get pointer to filehandle */
  65.     struct FileHandle *fh=(struct FileHandle *)BADDR(file);
  66.  
  67.     /* Get pointer to process structure */
  68.     struct Process *me=(struct Process *)FindTask(NULL);
  69.  
  70.     /* Get pointer to I/O request. Use stackspace for now. */
  71.     struct IOFileSys io,*iofs=&io;
  72.  
  73.     /* Prepare I/O request. */
  74.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  75.     iofs->IOFS.io_Message.mn_ReplyPort     =&me->pr_MsgPort;
  76.     iofs->IOFS.io_Message.mn_Length     =sizeof(struct IOFileSys);
  77.     iofs->IOFS.io_Device =fh->fh_Device;
  78.     iofs->IOFS.io_Unit     =fh->fh_Unit;
  79.     iofs->IOFS.io_Command=FSA_IS_INTERACTIVE;
  80.     iofs->IOFS.io_Flags  =0;
  81.  
  82.     /* Send the request. */
  83.     DoIO(&iofs->IOFS);
  84.  
  85.     /* Return */
  86.     if(iofs->io_DosError)
  87.     return 0;
  88.     else
  89.     return iofs->io_Args[0];
  90.  
  91.     AROS_LIBFUNC_EXIT
  92. } /* IsInteractive */
  93.